home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Media / HyperText Stacks Folder / Xref-Text / card_2155.txt < prev    next >
Encoding:
Text File  |  1988-05-03  |  2.7 KB  |  63 lines

  1. -- card: 2155 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2704
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 2
  9. ----- text -----
  10. topic
  11.  
  12. -- part contents for background part 1
  13. ----- text -----
  14. This is the original text of the GEnie topic* that got Xref-Text* started:
  15.  
  16. -- True HyperText* in HyperCard:
  17.  -- -- BUTTONS IN SCROLLING FIELDS! [or any kind of field, for that matter] -- -- make this the script of a locked text field on a card or background 
  18. -- you can click on any word to select it and go to card of that
  19.  -- name or number.
  20.  -- -- by Raines Cohen for the BMUG* HyperCard* SIG 9/16/87
  21.  -- [now meets* every other Monday at 6 PM at BMUG] 
  22. inspired by George Por of High^Lights publishing 
  23. -- please enhance, distribute, and spread around! 
  24. -- -- (and send me anything neat you come up with! <grin>:) 
  25. -- Raines* Cohen, c/o BMUG, 1442A Walnut #62, Berkeley CA 94709 
  26. -- AppleLink: UG0001.  Delphi,GEnie,BIX, the Well, MCI Mail: BMUG*
  27.  -- CIS:70007,2271.  ATT: (415) 849-9114. -- --
  28.  
  29. on mouseUp
  30.   if the selection* is empty then
  31.     set lockText of the target to false -- unlock to enable text editing
  32.     repeat two times
  33.       click at the clickLoc -- double click where the user clicked
  34.     end repeat
  35.     set lockText of the target to true
  36.   end if
  37.   if the selection* is not empty then -- we got a hit...
  38.     set lockText of the target to true
  39.     go card selection* -- This line is the link... see below.
  40.   end if
  41. end mouseUp
  42.  Alternative* forms of linking include:
  43. -- Searching a field of another stack: [instead of "go card selection" substitute:] put selection* into holder
  44. -- holder is a local var, just temporary go to stack
  45. "George's contribution" -- Part of a collaborative project, for instance find
  46. word holder in field "keywords" if the result is "not found" then 
  47. ...
  48. -- Only responding to words with an asterisk after them: [after "end repeat" of double click]
  49.  click at ((last item of rect of the target)-10,  (second item of clickLoc)) with ShiftKey -- shift-click at end of line to catch rest of line -- 10 is the width of the scrollbar
  50. if offset ("*",selection) = length of word 1 of selection* then -- last char of 1st word is a "*" => OK to xref ... 
  51. else
  52. click at clickLoc --disable selection*
  53. set the lockText of the target to true
  54.  
  55. ... -- Selecting whole line [like SFGetFile]: [instead of repeat loop with
  56. click]: click at (first item of the rect of target),  (second item of the
  57. clickLoc) click at (third item of the rect of target)-10,  (second item of the
  58. clickLoc) with shiftKey ... -- Deferred* action [instead of go card...] show
  59. bkgnd button "Do It" -- hidden unless something's selected show bkgnd button
  60. "Cancel selection" Good luck!  Remember to do this on a field with LOCKED
  61. TEXT, or it won t work! -- Raines Cohen
  62.    Team BMUG*
  63. -